<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	"http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<?php include("../api/conn.php"); ?>
		<?php include("../api/api.php"); ?>
		<?php include("info.php"); ?>
		<title><?=$WName;?></title>
		<script src="jqtouch/jquery.1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="jqtouch/jqtouch.js" type="text/javascript" charset="utf-8"></script>
		<script src="custom.js" type="text/javascript" charset="utf-8"></script>
		<script src="pause.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" href="jqtouch/jqtouch.css" type="text/css" media="screen" title="no title" charset="utf-8">
		<link id="main" rel="stylesheet" href="themes/apple/theme.css" type="text/css" media="screen"  charset="utf-8">
		<link id="custom" rel="stylesheet" href="themes/apple/custom.css" type="text/css" media="screen" charset="utf-8">
		<script type="text/javascript" charset="utf-8">
			initJQ();
			$(document).ready(function() {
				noAjaxCache();
				$("#newPost, #showPostForm").click(function() {
					$("#text").val("");
				});				
				$("#cs").click(function(event) {
					event.preventDefault();
					$(this).removeClass("active");
					var text = $(this).text();
					$(this).text("Coming Soon").delay(1000, function(){
						$(this).text(text);
					});
				});
				$("#postButton").click(function(event) {
					event.preventDefault();
					text = $("#text").val();
					$("#text").val("");
					loadURL = "post.php";
					$("#link").load(loadURL, {text: text}, function() {
						tid = $("#tid").text();
						$("#viewID").val(tid);
					});
				});
				$('#viewer').bind('pageAnimationStart', function(event){
					$("#showText").val("Loading Text");
					tid = $("#viewID").val();
					$("#showText").load("viewer.php", {tid: tid});
					$("#viewID").val("");
				});
			});
		</script>
	</head>
	<body>
		<div id="home">
			<div class="toolbar">
				<h1 id="home">
				<?php
					echo $WName;
					echo "&nbsp;";
					if (isset($WIsbeta)) {
					echo "Beta ".$WVersion;
					} else {
						echo "Version".$WVersion;
					}	
				?>
				</h1>
				<a href="#about" class="button slideup">About</a>
			</div>
			<ul class="rounded">
					<li class="arrow"><a href="#post" id="showPostForm">Shorten Some Text</a></li>
					<li class="arrow"><a href='#viewerInput'>Viewer</a></li>
				</ul> 
		</div>
		<div id="about">
			<div class="toolbar">
				<h1 id="about_3txt4i">About<3txt4i></h1>
				<a href="#" class="button cancel">&nbsp;&nbsp;&nbsp;&nbsp;Ok&nbsp;&nbsp;&nbsp;&nbsp;</a>
			</div>
			<h2>About</h2>
			<ul id="noBold" class="rounded">
				<li>
					<?php
						$var = rand(0,2);
						if ($var == 0) {
							echo "Welcome, Sir!";
						}
						if ($var == 1) {
							echo "Bienvenue, Monsieur!";
						}
						if ($var == 2) {
							echo "Bienvenido, señor!";
						}
					?>
				</li>
			</ul>
			<h2>Information!</h2>
			<ul class="rounded">
				<li>This version of <?=$WName;?> (<?php if(isset($WIsbeta)){ echo "Beta "; } echo $WVersion; ?>)
					is running <?=$name;?>
					<?php if(isset($isbeta)){ echo "Beta "; } else { echo "Version "; } echo $version; ?>.
				</li>
			</ul>
		</div>
		<div id="post">
			<div class="toolbar">
				<h1>Shorten!</h1>
				<a href="#" class="button back">Back</a>
			</div>
			<ul class="rounded">
				<form>
				<li><textarea id="text" placeholder="Paste your text here" name="text"></textarea></li>
				<li><a class="slideup" href="#done" id="postButton" class="submit">Shorten!</a></li>
				</form>
				<span style="display: none;" id="hidden"></span>
			</ul>
		</div>
		<div id="done">
			<div class="toolbar">
				<h1>Posted!</h1>
				<a href="#home" class="button cancel">Home</a>
			</div>
			<ul class="rounded">
				<li class="bold"><h2>Share!</h2></li>
				<li class="noBold" id="link">Loading Link...</li>
			</ul>
			<ul class="rounded">
				<li><h2>Want to Shorten something else?</h2></li>
				<li id="newPostHold"><a href="#post" id="#newPost" class="cancel">Click here</a></li>
			</ul>
		</div>
		<div id="viewerInput">
			<div class="toolbar">
				<h1>Viewer!</h1>
				<a href="#" class="button back">Back</a>
			</div>
			<ul class="rounded">
				<form>
				<li><input id="viewID" placeholder="Text ID e.g 'a'" name="viewerID" autocapitalize="off" type="text"></li>
				<li><a class="slideup" href="#viewer" id="view" class="submit">View!</a></li>
				</form>
			</ul>
		</div>
		<div id="viewer">
			<div class="toolbar">
				<h1>Viewer!</h1>
				<a href="#home" class="button cancel">Home</a>
			</div>
			<ul>
				<li id="showText">Loading Text</li>
			</ul>
		</div>
	</body>
</html>